<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateEventStudentCalendarPresentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    private  $table_name = 'event_student_calendar_present';
    public function up()
    {
        if (!Schema::hasTable($this->table_name)) {
            Schema::create($this->table_name, function (Blueprint $table) {
                $table->increments('id');
                $table->integer('student_id');
                $table->integer('event_id');
                $table->tinyInteger('status')->default(0);
                $table->string('name', 55)->comment('recipient name');
                $table->string('telephone', 16);
                $table->string('province', 6);
                $table->string('city', 32);
                $table->string('address');

                $table->timestamps();
                $table->softDeletes();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (app()->environment() !== 'production') {
            Schema::dropIfExists($this->table_name);
        }
    }
}
